local xjmy = fk.CreateSkill {
  name = "xjmy",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["xjmy"] = "兴继灭言",
  [":xjmy"] = "锁定技，当一名角色的体力值小于0时，你反转其体力值前的加减符，然后其摸等同于体力值的牌。",
}

-- 监听角色濒死事件
xjmy:addEffect(fk.HpChanged, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(xjmy.name) and target.hp < 0 and target.maxHp > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:setPlayerProperty(target, "hp", math.max(target.maxHp, -(target.hp)))
    if not target.dead then
      target:drawCards(target.hp, xjmy.name)
    end
  end
})


return xjmy
